# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-rb-inotify
_gemname=rb-inotify
pkgver=0.11.1
pkgrel=0
pkgdesc="A Ruby wrapper for Linux inotify, using FFI"
url="https://github.com/guard/rb-inotify"
arch="noarch"
license="MIT"
depends="ruby ruby-ffi"
checkdepends="ruby-concurrent-ruby ruby-rspec"
source="https://github.com/guard/rb-inotify/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	# Bundler is not necessary.
	sed -i '/require .bundler\/setup/d' spec/spec_helper.rb
}

build() {
	gem build $_gemname.gemspec
}

check() {
	# Bunler needs "Pathname" for its functionality, but we are not using Bundler,
	# therefore we need to load it explicitly.
	rspec -rpathname .
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc
}

sha512sums="
46966609686878d99c5a6623f5a3f55ef203ae32e48d0efbef295f97cc728c6938759360d445e052b82206322c7bf6f995db3007c7f3c0b2818549b8088be9bf  ruby-rb-inotify-0.11.1.tar.gz
2d9896ee5a81bc74d8921c4773771cf966dd5b164f6949857671afd2152a791377a18dd3c71cad7aefcd1d1d2f2b70fd366873f80269c672e750618e8e90e727  gemspec.patch
"
